<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        [v-cloak] {
            display: none;
        }
    </style>
</head>

<body>
    <div id="app" v-cloak>
        {{msg}}
        <hr>
        <son :fmsg="fmsg"></son>
    </div>
    <template id="son">
        <div>
            <h1>{{msg}}----{{mchange}}</h1>
            <button @click="changef">点击改变父组件传递过来的值</button>
            <button>点击发送自己的数据到父亲</button>
        </div>
    </template>
    <script src="./js/vue.js"></script>
    <script>
        let son = {
            props: {
                "fmsg": String
            },
            data() {
                return {
                    msg: "我是son",
                    sonMsg: "我是传递给父亲的值",
                    mchange: ""
                }
            },
            methods: {
                changef() {
                    this.mchange = this.fmsg;
                    this.mchange = "我偏要改";
                }
            },
            template: "#son"
        }
        let vm = new Vue({
            el: '#app',
            data: {
                msg: "Vue",
                fmsg: "我是父亲，给你的值别瞎动"
            },
            methods: {},
            components: {
                son
            }
        });
    </script>
</body>

</html>